const codeKeyLogin = ({ res, response }) => {
  res.setHeader('Content-Type', 'application/json')
  try {
    response = response.match(/codeKeyLogin_JSONPMethod\((.*?)\)/)[1]
    console.log(response)

    return JSON.stringify({
      data: JSON.parse(response).data,
      success: true
    })
  } catch (error) {
    return JSON.stringify({
      success: false
    })
  }
}

module.exports = {
  codeKeyLogin
}
